﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
	<head>
		<c:set var="contentPath" value="<%=request.getContextPath() %>" ></c:set>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="${contentPath }/css/ext-simlink-more.css" />
		<link rel="stylesheet" type="text/css" href="${contentPath }/css/all.css" />
		<script type="text/javascript" src="${contentPath }/jslib/jquery.min.js"></script>
		<title>用户管理</title>
	</head>
	<body>
		<div class="right">
			<div class="title">
				您现在所在的位置：
				<span class="spanSite">用户管理</span>
			</div>
			<form:form action="" method="post" id="pageForm" commandName="user">
			<table cellspacing="0" cellpadding="0" width="100%" align="center">
				<tr class="tr_white">
					<td colspan="9">
						<div class="shandow" style="height: 65px;">
							<table style="height: 60px;">
								<tr>
									<td class="menuTopTable">
										姓名：
									</td>
									<td width="165">
										<form:input path="username" maxlength="15" size="32" class="textInputview" />
									</td>
									<td class="menuTopTable">
										电话：
									</td>
									<td width="165">
										<form:input path="phone" maxlength="15" size="32" class="textInputview" />
									</td>
									<td  class="menuTopTable">
										<input type="button" class="search_href"
											onmouseover="this.className='search_href_hover'"
											onmouseout="this.className='search_href'" value=""
											onclick="javascript:search();" />
									</td>
								</tr>
							</table>
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%" cellpadding="0" cellspacing="0">
							<tr class="tr_white">
								<td colspan="9">
									<table class="trTitlePage" width="100%" cellpadding="0" cellspacing="0">
										<tr>
											<td class="buttonCssTop">
												<input type="button" class="buttonCss"
													onmouseover="this.className='buttonCss_hover'"
													onmouseout="this.className='buttonCss'" value="新增"
													onclick="javascript:add();"/>
												<input type="button" class="buttonCss"
													onmouseover="this.className='buttonCss_hover'"
													onmouseout="this.className='buttonCss'" value="修改"
													onclick="javascript:edit();"/>
												<input type="hidden" class="buttonCss"
													onmouseover="this.className='buttonCss_hover'"
													onmouseout="this.className='buttonCss'" value="启用"
													onclick="javascript:assignZt('1');" />
												<input type="hidden" class="buttonCss"
													onmouseover="this.className='buttonCss_hover'"
													onmouseout="this.className='buttonCss'" value="停用"
													onclick="javascript:assignZt('2');" />
												<input type="button" class="buttonCss"
													onmouseover="this.className='buttonCss_hover'"
													onmouseout="this.className='buttonCss'" value="删除"
													onclick="javascript:deleteZt();" />
											</td>
											<td align="right">
												<%@include file="/divPage.jsp"%>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table class="tableInf" width="100%" cellpadding="0" cellspacing="0">
							<tr class="tr_title">
								<td width="30" class="tableInfTd tdFontSize" nowrap="nowrap" align="center">
									<input type="checkbox">
								</td>
								<td width="100" class="tableInfTd tableInfTdview tdFontSize" style="text-align:center;">
									姓名
								</td>
								<td width="100" class="tableInfTd tableInfTdview tdFontSize" style="text-align:center;">
									性别
								</td>
								<td width="100" class="tableInfTd tableInfTdview tdFontSize" style="text-align:center;">
									电话
								</td>
								<td width="100" class="tableInfTd tableInfTdview tdFontSize" style="text-align:center;">
									联系地址
								</td>
								<td width="120" class="tableInfTd tableInfTdview tdFontSize" style="text-align:center;">
									email
								</td>
								<td width="100" class="tableInfTd tableInfTdview tdFontSize" style="text-align:center;">
									部门
								</td>
								<td width="100" class="tableInfTdview tdFontSize tdFontSize" style="text-align:center;">
									职位
								</td>
								<td class="tableInfTdview tdFontSize" style="text-align:center;">
									入职时间
								</td>
							</tr>
							<c:forEach items="${list}" var="obj" varStatus="status">
									<c:set var="tr_class"
										value="${status.index%2==1?'oddRow':'evenRow'}"></c:set>
								<tr class="${tr_class }" onmouseover="this.className='rowCss_hover'" onmouseout="this.className='${tr_class }'" ondblclick="openWindow(${obj.ygbh})">
									<td class="tdFontSize">
										<input type="checkbox" onclick="selObj(this,${obj.ygbh})">
									</td>
									<td class="tableInfTdview tdFontSize">
										${obj.username }
									</td>
									<td width="150" class="tableInfTdview tdFontSize">
										${obj.sex }
									</td>
									<td class="tableInfTdview tdFontSize">
										${obj.phone }
									</td>
									<td class="tableInfTdview tdFontSize">
										${obj.addres }
									</td>
									<td class="tableInfTdview tdFontSize">
										${obj.email }
									</td>
									<td class="tableInfTdview tdFontSize">
										${obj.department }
									</td>
									<td class="tableInfTdview tdFontSize">
										${obj.post }
									</td>
									<td class="tableInfTdview tdFontSize">
										${obj.createtime }
									</td>
								</tr>
							</c:forEach>
						</table>
					</td>
				</tr>
			</table>
			</form:form>
			<div id="waitingDiv" style="top: 25%; left: 45%; position: absolute; display: none;">
				<table cellpadding="0" cellspacing="0" border="0" class="waitingTable">
					<tr>
						<td>
							<img src="${contentPath}/images/loading.gif">
						</td>
						<td>
							&nbsp;&nbsp;正在处理，请稍等...
						</td>
					</tr>
				</table>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		var selObjId='';
		function selObj(obj,id){
			var flag=obj.checked;
			$("input[type='checkbox']").attr("checked",false);
			obj.checked=flag;
			if(flag) {
				selObjId=id;
			} else {
				selObjId='';
			}
		}
	
		function add(){
			var ret=null;
			var obj=new Object();
			obj.title="新增员工";
	       	obj.url = "${contentPath}/sys/user/add.do";
	        ret=window.showModalDialog("${contentPath}/showDialog.htm",obj,"dialogWidth:550px;dialogHeight:400px;center:1;scroll:1;help:0;status:0;resizable:1;edge:raised");	
	        document.getElementById('pageForm').action="${contentPath}/sys/user/list.do";
	        document.getElementById('pageForm').submit();
		}
		
		function edit(){
			if(selObjId==''){
				alert('请选择需要修改的用户!');
				return ;
			}
			var ret=null;
			var obj=new Object();
			obj.title="修改用户";
	       	obj.url = '${contentPath}/sys/user/add.do?id=' + selObjId;
	        ret=window.showModalDialog("${contentPath}/showDialog.htm",obj,"dialogWidth:550px;dialogHeight:400px;center:1;scroll:1;help:0;status:0;resizable:1;edge:raised");	
	        document.getElementById('pageForm').action="${contentPath}/sys/user/list.do";
	        document.getElementById('pageForm').submit();
		}
		//停用or启用
		function assignZt(isoff){
			if(selObjId==''){
				alert('请选择需要修改的指标!');
				return ;
			}
	       	document.getElementById('pageForm').action="${contentPath}/jxkh/jxzb/off.do?id="+ selObjId+"&isOff="+isoff;
	       	document.getElementById('pageForm').submit();
		}
		
		function deleteZt(){
			if(selObjId==''){
				alert('请选择需要删除的员工!');
				return ;
			}
			if (confirm("确认要删除吗？删除后不可恢复！"))
			{
				document.getElementById('pageForm').action="${contentPath}/sys/user/delete.do?id="+ selObjId;
	       		document.getElementById('pageForm').submit();
			}
			
		}
		
		function openWindow(id){
			var ret=null;
			var obj=new Object();
			obj.title="查看指标";
	       	obj.url = '${contentPath}/jxkh/jxzb/showZb.do?id=' + id;
	        ret=window.showModalDialog("${contentPath}/showDialog.htm",obj,"dialogWidth:600px;dialogHeight:500px;center:1;scroll:1;help:0;status:0;resizable:1;edge:raised");	
	        document.getElementById('pageForm').submit();
		}
		
		function search(){
			document.getElementById('pageForm').action="${contentPath}/sys/user/search.do";
			document.getElementById('pageForm').submit();
		}
	</script>
</html>
